package br.edu.univas.locadoragraph.bean;


import java.io.Serializable;

import java.util.List;


import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.event.ActionEvent;
import org.primefaces.model.DualListModel;

import br.edu.univas.locadoragraph.dao.DirectorDAO;
import br.edu.univas.locadoragraph.to.DirectorTO;



@ManagedBean(name = "directorBeanTable")
@SessionScoped
public class DirectorBeanTable implements Serializable  {
	private List<DirectorTO> diretores;
	
    private DirectorTO selectedDirector;
    private DirectorDAO directorDao;
    
    private DirectorTO directorTo;
    private String nameKey;
   
    
    public DirectorBeanTable() {
        
        directorDao = new DirectorDAO();
        directorTo = new DirectorTO();
        selectedDirector = new DirectorTO();
   }
    
    /*CRUD*/
    public void updateDirector(){
    	System.out.println("dao");
    	/*System.out.println(this.nameKey);
    	System.out.println(this.selectedDirector.getName());
    	System.out.println(this.selectedDirector.getGender());*/
    	this.directorDao.updateDirectorGraph(this.selectedDirector,this.nameKey);
    }
    /*Logica*/
    
    
    
 
   
    
    /*Get and Set*/
   

    public DirectorTO getSelectedDirector() {
        return selectedDirector;
    }

    public void setSelectedDirector(DirectorTO selectedDirector) {
    	this.selectedDirector = selectedDirector;
    }

	public List<DirectorTO> getDiretores() {
		if (diretores == null) {
		this.diretores = this.directorDao.getAllDirector();
		}
		return diretores;
	}
	
	public void setDiretores(List<DirectorTO> diretores) {
		this.diretores = diretores;
	}



	public DirectorDAO getActorDao() {
		return directorDao;
	}

	public void setDirectorDao(DirectorDAO directorDao) {
		this.directorDao = directorDao;
	}

	public DirectorTO getDirectorTo() {
		return directorTo;
	}

	public void setDirectorTo(DirectorTO directorTo) {
		this.directorTo = directorTo;
	}

	public DirectorDAO getDirectorDao() {
		return directorDao;
	}

	public String getNameKey() {
		return nameKey;
	}

	public void setNameKey(String nameKey) {
		this.nameKey = nameKey;
	}

	
	

	

	
	
	
    
    
}
